/**
 * 
 */
package com.angel.dao.generic.interfaces;

/** Define a strategy to manipulate transaction at data access object environment.
 * 
 * @author William
 *
 */
public interface TransactionStrategy {

	/** Get current session for transaction.
	 * 
	 * @return current session object.
	 */
	public Object getCurrentSession();
	
	/** Begin a new transaction in the current session.
	 * 
	 */
	public void beginTransaction();

	/** Commit current transaction in the session.
	 * 
	 */
	public void commit();
	
	/** Rollback current transaction in the session.
	 * 
	 */
	public void rollback();
	
	/** Verify if transaction is active or not. 
	 * 
	 * @return true if transaction is active. Otherwise it returns false.
	 */
	public boolean isActive();
	
	/** Set timeout to can rollback.
	 * 
	 * @param timeout time to wait before it rollback.
	 */
	public void setTimeout(int timeout);
	
	/** Verify if transaction was commited.
	 * 
	 * @return true if transaction was commited. Otherwise it returns false.
	 */
	public boolean wasCommited();
	
	/** Verify if transaction was rolledback.
	 * 
	 * @return true if transaction was rolledback. Otherwise it returns false.
	 */
	public boolean wasRolledBack();
}
